﻿/**************************************************************************************
 * Original Author : Anthony Leatherwood (adleatherwood@gmail.com)                              
 * Source Location : http://drivendb.codeplex.com     
 *  
 * This source is subject to the Microsoft Public License.
 * Link: http://drivendb.codeplex.com/license
 *  
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 
 **************************************************************************************/

using System;

namespace DrivenDb.Utility
{
    internal class Weak<T> 
    {
        private readonly WeakReference m_Target;
        
        public Weak(T target)
        {
            m_Target = new WeakReference(target);
        }

        public bool IsAlive
        {
            get { return m_Target.IsAlive; }
        }

        public T Target
        {
            get { return (T) m_Target.Target; }
        }
    }
}
